package com.xio.cloud.controller;

import com.xio.cloud.domain.CommonResult;
import com.xio.cloud.domain.OrderForm;
import com.xio.cloud.service.OrderFormService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: xio
 * @Description: 订单控制层
 * @Date: 2021/3/31 15:36
 */
@RestController
@RequestMapping
public class OrderFormController {

    @Resource
    private OrderFormService orderFormService;

    @GetMapping("/{id}")
    public OrderForm get(@PathVariable Long id) {
        return  orderFormService.getById(id);
    }

    @GetMapping("/order/create")
    public CommonResult create(OrderForm orderForm) {
        return CommonResult.of(orderFormService.createOrder(orderForm), "创建订单成功");
    }

}
